package com.sincereaddon.action;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by xjw on 2018/1/9.
 */
@RestController
public class TestAction {

    @RequestMapping("/test")
    public void test(HttpServletResponse response, HttpServletRequest request){
             writerObject(response,"test");
    }

    public  void writerObject(HttpServletResponse response, String message) {
        if (message != null) {
            response.setHeader("content-type", "text/html;charset=UTF-8");
            try {
                response.getWriter().write(message);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    }
}
